﻿CREATE PROCEDURE admin.s_Help_DependsOn_Xml
	@ObjectName sysname,
	@ObjectSchema sysname,
	@Xml xml OUT
AS
DECLARE @Table TABLE(Name sysname)
INSERT INTO @Table
EXEC admin.s_Help_DependsOn @ObjectName,@ObjectSchema
IF EXISTS(SELECT * FROM @Table)
	select @Xml =(
	select
	1 '@border',
	(select(select @ObjectSchema+'.'+@ObjectName+' Depends On' for xml path('th'),root('tr'),type)for xml path('thead'),type) ,
	(SELECT (select Name+'' for xml path('td'),type) FROM @Table for xml path('tr'),type)
	for xml path('table'),type
	)
